<?php 
define('__ROOT__', dirname(dirname(__FILE__))); 
include_once(__ROOT__.'../../includes/header.php');
include_once(__ROOT__.'../../includes/leftnav.php');
 ?>
<div class="span7">
<ul class="breadcrumb">
	<li>
		<a href="<?php echo base_url('/home'); ?>">Home</a> <span class="divider">/</span>
	</li>
	<li>
		<a href="<?php echo base_url('/admin/dashboard'); ?>">Dashboard</a><span class="divider">/</span>
	</li>
	<li>
		<a href="<?php echo base_url('/admin/classifieds/view'); ?>">Classifieds</a><span class="divider">/</span>
	</li>
	<li>
		Post Classfied Ad
	</li>
</ul>
<div id="content" class="span10">
<h4>Post any selling items on MayKha! Find out amazing results.</h4>
<?php 
echo validation_errors();
if (isset($message))
	echo '<p class="error">'. $message . '</p>';
$attributes = array('class' => 'form-horizontal' , 'id' => 'classifiedpostfrm');
echo form_open_multipart($action, $attributes);?>
	<fieldset>
			<div class="row-fluid">
				<div class="span9">
					<label>You want to:</label> 
					<select id="type" name="type" data-rel="chosen" class="span3">
						<option value="1" selected>Sell</option>
						<option value="2">Buy</option>
						<option value="3">Trade</option>
						<option value="4">Rent</option>
					</select>
				</div>
			</div>
			<div class="row-fluid">
				<!--/span-->
				<div class="span9">
					<label>Title</label> <input type="text" class="span12"
						placeholder="Enter your advertisement's title here" name="title" id="title" value="<?php echo set_value('title'); ?>">
				</div>
				<!--/span-->
			</div>
			<!--row-->
			<div class="row-fluid">
			<div class="span5">
					<label>Category</label>
					<select id="selectCatg" name="selectCatg" data-rel="chosen">
						<?php
						foreach ($catg as $key => $value) {
							echo '<option value="' . $key . '"';
							if (isset($selectedCatg)){
								if ((int)$selectedCatg  === (int)$key)
									echo 'selected ';
								}
							echo '>';
							echo $value;
							echo '</option>';

						}
						?>
					</select>
				 <p id="errorCatg"></p>
			</div>
			<div class="span5">
				<!--/span-->
				<div id="othCateg" class="span7 show_hide">
					<label>Enter Name:</label>
					<input id="othcatg" name="othcatg" type="text" class="span10"
						placeholder="category name" value="<?php echo set_value('othcatg'); ?>">
				</div>
				
			</div>
			</div>
			<!--/row-->
			<div class="row-fluid">
				<div class="span9">
					<label for="description">Descriptions <span id="descriptiondiv"></span>
					<textarea class="cleditor" id="description" name="description"
							rows="3">
							<?php echo set_value('description'); ?>
					</textarea>
					</label>
				</div>

			</div>
			<br>
			<!--/row-->
			<div class="row-fluid">
				<div class="span10">
					<label for"pprice">Price</label>
					<input id="pprice" name="pprice" class="span4 left" type="text" value="<?php echo set_value('pprice'); ?>">
					<select id="price_denote" name="price_denote" class="span3 right">
					  <option value="KS" selected>KS</option>
					  <option value="LAKH">LAKH</option>
					  <option value="USD">USD</option>
					  <option value="SGD">SGD</option>
					  <option value="CNY">CNY</option>
					</select>
					<div id="pricediv"></div>
				</div>
				
				</div>
				<div class="row-fluid">
				<div class="span5">
					<label>Discount (%)</label>
					<input id="percentage" name="percentage" class="span10" type="text" value="<?php echo set_value('percentage'); ?>">
				</div>
				<div class="span2">
					<label>Quantity</label>
					<input id="quantity" name="quantity" type="text" class="span4"
						placeholder="1" value="<?php echo set_value('quantity'); ?>">
					<br>
				</div>
			</div>
			<fieldset>
			<legend>Contact Information</legend>
			<div class="row-fluid">
				<div class="span4">
					<label>Contact Person</label> 
					<input id="contact_person" name="contact_person" class="span10" type="text" value="<?php echo set_value('contact_person', isset($user['displayName']) ? $user['displayName'] : $user['name']); ?>">
				</div>
				<!--/span-->
				<div class="span4">
					<label>Contact No</label>
					<input id="contact_no" name="contact_no"
						class="span10" type="text"  value="<?php echo set_value('contact_no',$user['phone']); ?>">
				</div><!--/span-->
			</div>
			<!-- /row -->
			<div class="row-fluid">
				<div class="span4">
					<label>Email</label> <input id="contact_email" name="contact_email" type="text" class="span10"
						placeholder="user@example.com" value="<?php echo set_value('contact_email', $user['email']); ?>">
				</div>
				<div class="span4">
					<label>Expired On</label>
					<input id="expired_date" name="expired_date" type="text" class="span10"
						placeholder="DD/MM/YYYY" value="<?php echo set_value('expired_date', $expired_date); ?>">
				</div>
				<!--/span-->
			</div>
			</fieldset>
			<!-- /row -->
			<div class="row-fluid">
				<div class="span12">
					<label>Add Images</label> <input data-no-uniform="true"
						type="file" name="userfile[]" id="file_upload" multiple="multiple" />
					<p class="help-block">Choose muliple files (Maximum 4 images)</p>
				</div>
			</div>
			<!-- /row -->
			<div class="form-actions">
				<button type="submit" class="btn btn-primary">Submit</button>
				<button class="btn" type="reset">Cancel</button>
			</div>
			<!-- /row -->
	</fieldset>
</div>
</div>
<!-- right nav -->
</div>
<?php
 include_once(__ROOT__.'../../includes/footer.php'); 
 ?>